﻿using GodSystemDAL;
using GodSystemModel;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GodSystemBLL
{
    public class CateBLL
    {
        private static CategoriesDAL categoriesDAL = new CategoriesDAL();
        public int AddCate(string cateName, string createUser)
        {
            CategoriesModel cate = new CategoriesModel();
            cate.CreateUser = createUser;
            cate.CateName = cateName;
            return categoriesDAL.AddCate(cate);
        }


        public object CheckCateName(string cateName)
        {
            CategoriesModel cate = new CategoriesModel();
            cate.CateName = cateName;
            return categoriesDAL.CheckCateName(cate);
        }


        public DataTable GetCategories()
        {
            return categoriesDAL.GetCategories();
        }


        public int UpdateCateName(string cateName, int id)
        {
            CategoriesModel cate = new CategoriesModel();
            cate.CateName = cateName;
            cate.Id = id;   
            return categoriesDAL.UpdateCateName(cate);
        }
    }
}
